package task;

public class duoChong3 {
    public static void main(String[] args) {
      //3、使用 * 打印矩形、直角三角形、等腰三角形、菱形图案。
        for(int i=1;i<=5;i++) {
            //输出一列星星
            for (int j=1;j<=6;j++){
                System.out.print("*");
            }
            //换到下一行
            System.out.println();
        }
        for (int i = 1; i <=5 ; i++) {
            for (int j=1;j<=i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
        //等腰三角形int i=5；第一行有5个空格，依次减一，有（2i-1）个*
        for (int i=1;i<=5;i++){
            for (int j = 1; j <= 5 - i; j++) {
                System.out.print(" ");
            }
            for (int j=1;j<=2*i-1;j++){
                System.out.print("*");//*可变成与i有关的数，如2i-1
            }
            System.out.println();
        }
        //菱形
        int size=5;
        for (int i = 1; i <= size; i++) {
            for (int j = 1; j <= size - i; j++) {
                System.out.print(" ");
            }

            for (int k = 1; k <= 2 * i - 1; k++) {
                System.out.print('*');
            }
            System.out.println();
        }
        for (int i = 1; i <= size-1; i++) {
            for (int j = 1; j <= i; j++){
                System.out.print(" ");
            }

            for (int k = 2*size-3; k >= 2 * i - 1; k--){//继续从第六行写。此时初始的长度的k=7
                System.out.print('*');
            }
            System.out.println();
        }
    }
}
